#include "motor_control.h"
#include "tim.h"


/**
 * @brief  第一版 侧屈初始状态回归
 * @param  void
 * @retval none
 */
void FIRST_Origin_state_bend(Remote_t *remote){
    TIM_start();
    while(remote->time_count < 38230 && remote->MODE_flag != STOP_MODE){
        Motor2_control(1);
        if(remote->time_count < 18480){
            Motor3_control(1);
            Motor5_control(1);
        }
        else{
            Motor3_control(0);
            Motor5_control(0);
        }
        if(remote->time_count < 19480){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }
        if(remote->time_count < 20480){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }

        if(remote->time_count < 8520){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }
    }
    Motor2_control(0);
    TIM_stop(&remote->time_count);
    remote->Statu = Initial_bend_statu_1;
}

/**
 * @brief  第一版 初始状态升降回归
 * @param  uint16_t *
 * @retval none
 */
void FIRST_Origin_state_lift(Remote_t *remote){
    TIM_start();
    while(remote->time_count < 29700 && remote->MODE_flag != STOP_MODE){
        Motor2_control(1);
        if(remote->time_count < 11400){
            Motor1_control(1);
            Motor3_control(1);
            Motor5_control(1);
            Motor6_control(1);
        }
        else{
            Motor1_control(0);
            Motor3_control(0);
            Motor5_control(0);
            Motor6_control(0);
        }

        if(remote->time_count < 1000){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }
    }
    Motor2_control(0);
    TIM_stop(&remote->time_count);
    remote->Statu = Initial_lift_statu_1;
}


/**
 * @brief  第二版 侧屈初始状态回归
 * @param  void
 * @retval TODO:好像有点问题
 */
void SECOND_Origin_state_bend(Remote_t *remote){
    TIM_start();
    while(remote->time_count < 37241 + 1000 && remote->MODE_flag != STOP_MODE){
        Motor2_control(1);
        if(remote->time_count < 18070 + 1000){
            Motor6_control(1);
            Motor5_control(1);
        }
        else{
            Motor6_control(0);
            Motor5_control(0);
        }
        if(remote->time_count < 18059 + 1000){
            Motor1_control(1);
            Motor3_control(1);
        }
        else{
            Motor1_control(0);
            Motor3_control(0);
        }

        if(remote->time_count < 8388 + 1000){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }
    }
    Motor_ALL_set(0);
    TIM_stop(&remote->time_count);
    remote->Statu = Initial_bend_statu_2;
}


/**
 * @brief  第一版前屈
 * @param  void
 * @retval none
 */
void FrontBend_1(Remote_t *remote){
    // 1
    TIM_start();
    while(remote->time_count < 4327 + 900 && remote->MODE_flag != STOP_MODE){
        //杆4
        if(remote->time_count < 4425 + 400 + 200){
            Motor4_control(1);
        }
        //杆5
        if(remote->time_count < 2793 || (remote->time_count >= 3000 && remote->time_count < 4327 + 600 + 300)){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 2993 || (remote->time_count >= 3000 && remote->time_count < 4327 + 800))
            Motor6_control(1);
        else
            Motor6_control(0);


        //杆2
        if(remote->time_count < 4393 + 400){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }
        //杆13
        if(remote->time_count < 2812){
            Motor1_control(2);
            Motor3_control(2);    
        }
        else if(remote->time_count >= 3000 && remote->time_count < 4306 + 800){
            Motor1_control(2);
            Motor3_control(2);  
        }
        else{
            Motor1_control(0);
            Motor3_control(0);  
        }
        
    }
    TIM_stop(&remote->time_count);
    //2
    TIM_start();
    while(remote->time_count < 4312 + 900 && remote->MODE_flag != STOP_MODE){
        //杆4
        if(remote->time_count < 4414 + 400 + 200){
            Motor4_control(1);
        }
        //杆5
        if(remote->time_count < 2782 || (remote->time_count >= 3000 && remote->time_count < 4312 + 600 + 300)){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 2982 || (remote->time_count >= 3000 && remote->time_count < 4312 + 800))
            Motor6_control(1);
        else
            Motor6_control(0);



        //杆2
        if(remote->time_count < 4323 + 400){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }
        //杆13
        if(remote->time_count < 2832){
           Motor1_control(2);
          Motor3_control(2);     
        }
        else if(remote->time_count >= 3000 && remote->time_count < 4249 + 800){
           Motor1_control(2);
          Motor3_control(2);   
        }
        else{
            Motor1_control(0);
            Motor3_control(0);  
        }
    }
    Motor1_control(0);
    Motor2_control(0);
    Motor3_control(0);  
    TIM_stop(&remote->time_count);

    //3
    TIM_start();
    while(remote->time_count < 4269 + 900 && remote->MODE_flag != STOP_MODE){
        //杆4
        if(remote->time_count < 4374 + 400 + 200){
            Motor4_control(1);
        }
        //杆5
        if(remote->time_count < 2771 || (remote->time_count >= 3000 && remote->time_count < 4269 + 600 + 300)){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 2971 || (remote->time_count >= 3000 && remote->time_count < 4269 + 800))
            Motor6_control(1);
        else
            Motor6_control(0);



        //杆2
        if(remote->time_count < 4208 + 400){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }
        //杆13
        if(remote->time_count < 2857){
           Motor1_control(2);
          Motor3_control(2);     
        }
        else if(remote->time_count >= 3000 && remote->time_count < 4151 + 800){
           Motor1_control(2);
          Motor3_control(2);   
        }
        else{
            Motor1_control(0);
            Motor3_control(0);  
        }
    }
    Motor1_control(0);
    Motor2_control(0);
    Motor3_control(0);  
    TIM_stop(&remote->time_count);

    //4
    TIM_start();
    while(remote->time_count < 4203 + 900 && remote->MODE_flag != STOP_MODE){
        //杆4
        if(remote->time_count < 4308 + 400 + 200){
            Motor4_control(1);
        }
        //杆5
        if(remote->time_count < 2759 || (remote->time_count >= 3000 && remote->time_count < 4203 + 600 + 300)){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 2959 || (remote->time_count >= 3000 && remote->time_count < 4203 + 800))
            Motor6_control(1);
        else
            Motor6_control(0);



        //杆2
        if(remote->time_count < 4043 + 400){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }
        //杆13
        if(remote->time_count < 2886){
           Motor1_control(2);
          Motor3_control(2);     
        }
        else if(remote->time_count >= 3000 && remote->time_count < 4003 + 800){
           Motor1_control(2);
          Motor3_control(2);   
        }
        else{
            Motor1_control(0);
            Motor3_control(0);  
        }
    }
    Motor1_control(0);
    Motor2_control(0);
    Motor3_control(0);  
    TIM_stop(&remote->time_count);


    //5
    TIM_start();
    while(remote->time_count < 4117 + 900 && remote->MODE_flag != STOP_MODE){
        //杆4
        if(remote->time_count < 4220 + 400 + 200){
            Motor4_control(1);
        }
        //杆5
        if(remote->time_count < 2746 || (remote->time_count >= 3000 && remote->time_count < 4117 + 600 + 300)){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 2946 || (remote->time_count >= 3000 && remote->time_count < 4117 + 800))
            Motor6_control(1);
        else
            Motor6_control(0);



        //杆2
        if(remote->time_count < 3820 + 400){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }
        //杆13
        if(remote->time_count < 2924){
           Motor1_control(2);
          Motor3_control(2);     
        }
        else if(remote->time_count >= 3000 && remote->time_count < 3799 + 800){
           Motor1_control(2);
          Motor3_control(2);   
        }
        else{
            Motor1_control(0);
            Motor3_control(0);  
        }
    }
    Motor1_control(0);
    Motor2_control(0);
    Motor3_control(0);  
    Motor4_control(0);
    Motor5_control(0);
    Motor6_control(0);
    TIM_stop(&remote->time_count);
    remote->Statu = Farward_statu_1;
}


/**
 * @brief  第二版前屈
 * @param  void
 * @retval none
 */
void FrontBend_2(Remote_t *remote){
    // 1
    TIM_start();
    while(remote->time_count <  3797 + 1200 && remote->MODE_flag != STOP_MODE){
        //杆2
        if(remote->time_count < 4027 + 200){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }
        //杆13
        if(remote->time_count < 3784+400){
            Motor1_control(2);
            Motor3_control(2);    
        }
        else{
            Motor1_control(0);
            Motor3_control(0);  
        }
        //杆4
        if(remote->time_count < 4065 + 600){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }
        //杆5
        if(remote->time_count < 3797 + 600){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 3797 + 1200){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }

    }
    Motor4_control(0);
    TIM_stop(&remote->time_count);
    //2
    TIM_start();
    while(remote->time_count < 3784 + 1200 && remote->MODE_flag != STOP_MODE){
        //杆2
        if(remote->time_count < 3959 + 200){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }
        //杆13
        if(remote->time_count < 3746+400){
            Motor1_control(2);
            Motor3_control(2);    
        }
        else{
            Motor1_control(0);
            Motor3_control(0);  
        }
        //杆4
        if(remote->time_count < 4070 + 600){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }
        //杆5
        if(remote->time_count < 3784 + 600){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 3784 + 1200){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }

    }
    Motor4_control(0); 
    TIM_stop(&remote->time_count);

    //3
    TIM_start();
    while(remote->time_count < 3750 + 1200 && remote->MODE_flag != STOP_MODE){

        //杆2
        if(remote->time_count < 3855 + 200){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }
        //杆13
        if(remote->time_count < 3676+400){
            Motor1_control(2);
            Motor3_control(2);    
        }
        else{
            Motor1_control(0);
            Motor3_control(0);  
        }
        //杆4
        if(remote->time_count < 4052 + 600){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }
        //杆5
        if(remote->time_count < 3750 + 600){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 3750 + 1200){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }

    }
    Motor4_control(0); 
    TIM_stop(&remote->time_count);

    //4
    TIM_start();
    while(remote->time_count < 1848*2 + 1200 && remote->MODE_flag != STOP_MODE){

        //杆2
        if(remote->time_count < 1856*2 + 200){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }
        //杆13
        if(remote->time_count < 1786*2+400){
            Motor1_control(2);
            Motor3_control(2);    
        }
        else{
            Motor1_control(0);
            Motor3_control(0);  
        }
        //杆4
        if(remote->time_count < 4010 + 600){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }
        //杆5
        if(remote->time_count < 1848*2 + 600){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 1848*2 + 1200){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }

    }
    Motor4_control(0);  
    TIM_stop(&remote->time_count);


    //5
    TIM_start();
    while(remote->time_count < 4824 && remote->MODE_flag != STOP_MODE){
        //杆2
        if(remote->time_count < 1762*2 + 200){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }
        //杆13
        if(remote->time_count < 3430+400){
            Motor1_control(2);
            Motor3_control(2);    
        }
        else{
            Motor1_control(0);
            Motor3_control(0);  
        }
        //杆4
        if(remote->time_count < 3950 + 600){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }
        //杆5
        if(remote->time_count < 3624 + 600){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 4824){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }

    }
    Motor1_control(0);
    Motor2_control(0);
    Motor3_control(0);  
    Motor4_control(0);
    Motor5_control(0);
    Motor6_control(0);
    TIM_stop(&remote->time_count);
    remote->Statu = Farward_statu_2;
}


/**
 * @brief  第一版前屈回
 * @param  void
 * @retval none
 */
void FrontBend_back_1(Remote_t *remote){
    // 1
    TIM_start();
    while(remote->time_count < 4923 && remote->MODE_flag != STOP_MODE){
        //杆4
        if(remote->time_count < 4220 + 400){
            Motor4_control(2);
        }
        //杆5
        if(remote->time_count < 2746 || (remote->time_count >= 3000 && remote->time_count < 4117 + 400)){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 2946 || (remote->time_count >= 3000 && remote->time_count < 4117 + 600 + 400))
            Motor6_control(2);
        else
            Motor6_control(0);



        //杆2
        if(remote->time_count < 3820 + 400){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }
        //杆13
        if(remote->time_count < 2924 + 799+1200){
           Motor1_control(1);
          Motor3_control(1);     
        }
        // else if(remote->time_count >= 3000 && remote->time_count < 3799){
        //    Motor1_control(1);
        //   Motor3_control(1);   
        // }
        else{
            Motor1_control(0);
            Motor3_control(0);  
        }
    }
    TIM_stop(&remote->time_count);

    // HAL_Delay(1000);

    //2
    TIM_start();
    while(remote->time_count < 5089 && remote->MODE_flag != STOP_MODE){
        //杆4
        if(remote->time_count < 4308 + 400){
            Motor4_control(2);
        }
        //杆5
        if(remote->time_count < 2759 || (remote->time_count >= 3000 && remote->time_count < 4203 + 400)){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 2959 || (remote->time_count >= 3000 && remote->time_count < 4203 + 600 + 400))
            Motor6_control(2);
        else
            Motor6_control(0);



        //杆2
        if(remote->time_count < 4043 + 400){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }
        //杆13
        if(remote->time_count < 2886 + 1003  +1200){
           Motor1_control(1);
          Motor3_control(1);     
        }
        // else if(remote->time_count >= 3000 && remote->time_count < 4003){
        //    Motor1_control(1);
        //   Motor3_control(1);   
        // }
        else{
            Motor1_control(0);
            Motor3_control(0);  
        }
    }
    // Motor1_control(0);
    // Motor2_control(0);
    // Motor3_control(0);  
    TIM_stop(&remote->time_count);

    // HAL_Delay(1000);

    //3
    TIM_start();
    while(remote->time_count < 5208 && remote->MODE_flag != STOP_MODE){
        //杆4
        if(remote->time_count < 4374 + 400){
            Motor4_control(2);
        }
        //杆5
        if(remote->time_count < 2771 || (remote->time_count >= 3000 && remote->time_count < 4269 + 400)){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 2971 || (remote->time_count >= 3000 && remote->time_count < 4269 + 600 + 400))
            Motor6_control(2);
        else
            Motor6_control(0);



        //杆2
        if(remote->time_count < 4208 + 400){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }
        //杆13
        if(remote->time_count < 2857 + 1151 + 1200){
           Motor1_control(1);
          Motor3_control(1);     
        }
        // else if(remote->time_count >= 3000 && remote->time_count < 4151){
        //    Motor1_control(1);
        //   Motor3_control(1);   
        // }
        else{
            Motor1_control(0);
            Motor3_control(0);  
        }
    }
    // Motor1_control(0);
    // Motor2_control(0);
    // Motor3_control(0);  
    TIM_stop(&remote->time_count);

    // HAL_Delay(1000);

    //4
    TIM_start();
    while(remote->time_count < 5281 && remote->MODE_flag != STOP_MODE){
        //杆4
        if(remote->time_count < 4414 + 400){
            Motor4_control(2);
        }
        //杆5
        if(remote->time_count < 2782 || (remote->time_count >= 3000 && remote->time_count < 4312 + 400)){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 2982 || (remote->time_count >= 3000 && remote->time_count < 4312 + 600 + 400))
            Motor6_control(2);
        else
            Motor6_control(0);



        //杆2
        if(remote->time_count < 4323 + 400){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }
        //杆13
        if(remote->time_count < 2832 + 1249 + 1200){
           Motor1_control(1);
          Motor3_control(1);     
        }
        // else if(remote->time_count >= 3000 && remote->time_count < 4249){
        //    Motor1_control(1);
        //   Motor3_control(1);   
        // }
        else{
            Motor1_control(0);
            Motor3_control(0);  
        }
    }
    // Motor1_control(0);
    // Motor2_control(0);
    // Motor3_control(0);  
    TIM_stop(&remote->time_count);

    // HAL_Delay(1000);

    //5
    TIM_start();
    while(remote->time_count < 5318 && remote->MODE_flag != STOP_MODE){
        //杆4
        if(remote->time_count < 4425 + 400){
            Motor4_control(2);
        }
        //杆5
        if(remote->time_count < 2793 || (remote->time_count >= 3000 && remote->time_count < 4327 + 400)){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 2993 || (remote->time_count >= 3000 && remote->time_count < 4327 + 600 + 400))
            Motor6_control(2);
        else
            Motor6_control(0);


        //杆2
        if(remote->time_count < 4393 + 400){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }
        //杆13
        if(remote->time_count < 2812 + 1306 + 1200){
            Motor1_control(1);
            Motor3_control(1);    
        }
        // else if(remote->time_count >= 3000 && remote->time_count < 4306){
        //     Motor1_control(1);
        //     Motor3_control(1);  
        // }
        else{
            Motor1_control(0);
            Motor3_control(0);  
        }
        
    }
    Motor1_control(0);
    Motor2_control(0);
    Motor3_control(0);  
    Motor4_control(0);
    Motor5_control(0);
    Motor6_control(0);
    TIM_stop(&remote->time_count);
    remote->Statu = Initial_bend_statu_1;
}


/**
 * @brief  第二版前屈回
 * @param  void
 * @retval none
 */
void FrontBend_back_2(Remote_t *remote){

    // 1
    TIM_start();
    while(remote->time_count < 3950 + 400 && remote->MODE_flag != STOP_MODE){

        //杆2
        if(remote->time_count < 1762*2+400){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }
        //杆1
        if(remote->time_count < 1715*2 + 400){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }
        //3
        if(remote->time_count < 1715*2 + 600){
            Motor3_control(1);    
        }
        else{
            Motor3_control(0);  
        }

        //杆4
        if(remote->time_count < 3950 + 400){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }
        //杆56
        if(remote->time_count < 1812*2 + 400){
            Motor5_control(2);
            Motor6_control(2);
        }
        else{
            Motor5_control(0);
            Motor6_control(0);
        }

    }
    Motor4_control(0);
    TIM_stop(&remote->time_count);
    //2
    TIM_start();
    while(remote->time_count < 4010 + 400 && remote->MODE_flag != STOP_MODE){


        //杆2
        if(remote->time_count < 1856*2+400){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }
        //杆1
        if(remote->time_count < 1786*2 + 400){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }
        //3
        if(remote->time_count < 1786*2 + 600){
            Motor3_control(1);    
        }
        else{
            Motor3_control(0);  
        }

        //杆4
        if(remote->time_count < 4010 + 400){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }
        //杆56
        if(remote->time_count < 1848*2 + 400){
            Motor5_control(2);
            Motor6_control(2);
        }
        else{
            Motor5_control(0);
            Motor6_control(0);
        }


    }
    Motor4_control(0); 
    TIM_stop(&remote->time_count);

    //3
    TIM_start();
    while(remote->time_count < 4052 + 400 && remote->MODE_flag != STOP_MODE){

        //杆2
        if(remote->time_count < 3855+400){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }
        //杆1
        if(remote->time_count < 3676 + 400){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }
        //3
        if(remote->time_count < 3676 + 600){
            Motor3_control(1);    
        }
        else{
            Motor3_control(0);  
        }

        //杆4
        if(remote->time_count < 4052 + 400){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }
        //杆56
        if(remote->time_count < 3750 + 400){
            Motor5_control(2);
            Motor6_control(2);
        }
        else{
            Motor5_control(0);
            Motor6_control(0);
        }


    }
    Motor4_control(0); 
    TIM_stop(&remote->time_count);

    //4
   TIM_start();
    while(remote->time_count < 4070 + 400 && remote->MODE_flag != STOP_MODE){


        //杆2
        if(remote->time_count < 3959+400){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }
        //杆1
        if(remote->time_count < 3746 + 400){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }
        //3
        if(remote->time_count < 3746 + 600){
            Motor3_control(1);    
        }
        else{
            Motor3_control(0);  
        }

        //杆4
        if(remote->time_count < 4070 + 400){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }
        //杆56
        if(remote->time_count < 3784 + 400){
            Motor5_control(2);
            Motor6_control(2);
        }
        else{
            Motor5_control(0);
            Motor6_control(0);
        }


    }
    Motor4_control(0);  
    TIM_stop(&remote->time_count);


    //5
    TIM_start();
    while(remote->time_count < 4065 + 400 && remote->MODE_flag != STOP_MODE){

        //杆2
        if(remote->time_count < 4027+400){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }
        //杆1
        if(remote->time_count < 3784 + 400){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }
        //3
        if(remote->time_count < 3784 + 600){
            Motor3_control(1);    
        }
        else{
            Motor3_control(0);  
        }

        //杆4
        if(remote->time_count < 4065 + 400){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }
        //杆56
        if(remote->time_count < 3797 + 400){
            Motor5_control(2);
            Motor6_control(2);
        }
        else{
            Motor5_control(0);
            Motor6_control(0);
        }

        
    }
    Motor1_control(0);
    Motor2_control(0);
    Motor3_control(0);  
    Motor4_control(0);
    Motor5_control(0);
    Motor6_control(0);
    TIM_stop(&remote->time_count);
    remote->Statu = Initial_bend_statu_2;
}



/**
 * @brief  第一版向右侧屈
 * @param  void
 * @retval none
 * @note   侧屈25
 */
void RightBend_1(Remote_t *remote){
    // 1
    TIM_start();
    while(remote->time_count < (3807 + 700) && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3828 + 200){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 4 + 200){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < (3807 + 460 + 200)){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 158){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3828){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }


        //6
        if(remote->time_count < (3807 + 700 + 400)){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }

    }
    TIM_stop(&remote->time_count);

    // HAL_Delay(1000);

    //2
    TIM_start();
    while(remote->time_count < (3760 + 700) && remote->MODE_flag != STOP_MODE){        
        //1
        if(remote->time_count < 3822 + 200){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 13 + 200){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < (3760 + 460 + 200)){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 369){
            Motor4_control(1);
        }
        else if(remote->time_count >= 3000 && remote->time_count < 3034){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3822){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }


        //6
        if(remote->time_count < (3760 + 700 + 400)){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }

    }
    TIM_stop(&remote->time_count);

    //3
    TIM_start();
    while(remote->time_count < (3690 + 700) && remote->MODE_flag != STOP_MODE){   
        //1
        if(remote->time_count < 3783 + 200){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 21 + 200){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < (3691 + 460 + 200)){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 613){
            Motor4_control(1);
        }
        else if(remote->time_count >= 3000 && remote->time_count < 3160){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3783){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }


        //6
        if(remote->time_count < (3690 + 700 + 400)){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //4
    TIM_start();
    while(remote->time_count < (3600 + 700) && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3709 + 200){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 30 + 200){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < (3601 + 460 + 200)){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 858){
            Motor4_control(1);
        }
        else if(remote->time_count >= 3000 && remote->time_count < 3203){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3710){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }


        //6
        if(remote->time_count < (3600 + 700 + 400)){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //5
    TIM_start();
    while(remote->time_count < (3493 + 700) && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3595 + 200){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 38 + 200){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < (3493 + 460 + 200)){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 1109){
            Motor4_control(1);
        }
        else if(remote->time_count >= 3000 && remote->time_count < 3220){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3596){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }


        //6
        if(remote->time_count < (3493 + 700 + 400)){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }
    }
    Motor1_control(0);
    Motor2_control(0);
    Motor3_control(0);  
    Motor4_control(0);
    Motor5_control(0);
    Motor6_control(0);
    TIM_stop(&remote->time_count);
    remote->Statu = Right_statu_1;
}

/**
 * @brief  第二版向右侧屈
 * @param  void
 * @retval none
 * @note   侧屈25
 */
void LeftBend_2(Remote_t *remote){
    // 1
    TIM_start();
    while(remote->time_count < 3691 && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3691){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 36){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < 3670){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 145){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3690){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
        //6
        if(remote->time_count < 3670){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //2
    TIM_start();
    while(remote->time_count < 3687 && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3687){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 29){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < 3626){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 434){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3687){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
        //6
        if(remote->time_count < 3626){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //3
    TIM_start();
    while(remote->time_count < 3655 && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3655){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 21){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < 3563){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 357){
            Motor4_control(1);
        }
        else if(remote->time_count >= 1827 && remote->time_count <= 2184){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3655){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
        //6
        if(remote->time_count < 3562){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //4
    TIM_start();
    while(remote->time_count < 3593 && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3593){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 14){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < 3481){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 491){
            Motor4_control(1);
        }
        else if(remote->time_count >= 1796 && remote->time_count <= 2288){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3593){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
        //6
        if(remote->time_count < 3481){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //5
    TIM_start();
    while(remote->time_count < 3495 && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3494){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 7){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < 3383){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 617){
            Motor4_control(1);
        }
        else if(remote->time_count >= 1747 && remote->time_count <= 2364){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }
        //5
        if(remote->time_count < 3495){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
        //6
        if(remote->time_count < 3383){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }
    }
    Motor1_control(0);
    Motor2_control(0);
    Motor3_control(0);  
    Motor4_control(0);
    Motor5_control(0);
    Motor6_control(0);
    TIM_stop(&remote->time_count);
    remote->Statu = Right_statu_2;
}


/**
 * @brief  第一版向右侧屈回
 * @param  void
 * @retval none
 * @note   侧屈25
 */
void RightBend_back_1(Remote_t *remote){
    // 1
    TIM_start();
    while(remote->time_count < (3493 + 700 + 200) && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3595){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 38){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < (3493 + 460)){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 1109){
            Motor4_control(2);
        }
        else if(remote->time_count >= 3000 && remote->time_count < 3220){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3596){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }


        //6
        if(remote->time_count < (3493 + 700)){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    // HAL_Delay(1000);

    //2
    TIM_start();
    while(remote->time_count < (3600 + 700) && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3709 + 200){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 30){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < (3601 + 460)){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 858){
            Motor4_control(2);
        }
        else if(remote->time_count >= 3000 && remote->time_count < 3203){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3710){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }


        //6
        if(remote->time_count < (3600 + 700)){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //3
    TIM_start();
    while(remote->time_count < (3690 + 700) && remote->MODE_flag != STOP_MODE){   
        //1
        if(remote->time_count < 3783 + 200){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 21){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < (3691 + 460)){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 613){
            Motor4_control(2);
        }
        else if(remote->time_count >= 3000 && remote->time_count < 3160){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3783){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }


        //6
        if(remote->time_count < (3690 + 700)){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //4
    TIM_start();
    while(remote->time_count < (3760 + 700) && remote->MODE_flag != STOP_MODE){        
        //1
        if(remote->time_count < 3822 + 200){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 13){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < (3760 + 460)){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 369){
            Motor4_control(2);
        }
        else if(remote->time_count >= 3000 && remote->time_count < 3034){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3822){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }


        //6
        if(remote->time_count < (3760 + 700)){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }

    }
    TIM_stop(&remote->time_count);

    //5
    TIM_start();
    while(remote->time_count < (3807 + 700) && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3828 + 200){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 4){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < (3807 + 460)){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 158){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3828){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }


        //6
        if(remote->time_count < (3807 + 700)){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }

    }
    Motor1_control(0);
    Motor2_control(0);
    Motor3_control(0);  
    Motor4_control(0);
    Motor5_control(0);
    Motor6_control(0);
    TIM_stop(&remote->time_count);
    remote->Statu = Initial_bend_statu_1;
}

/**
 * @brief  第二版向右侧屈回
 * @param  void
 * @retval none
 * @note   侧屈25
 */
void LeftBend_back_2(Remote_t *remote){
    // 1
    TIM_start();
    while(remote->time_count < 3495 && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3494){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 7){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < 3383){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 617){
            Motor4_control(2);
        }
        else if(remote->time_count >= 1747 && remote->time_count <= 2364){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }
        //5
        if(remote->time_count < 3495){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //6
        if(remote->time_count < 3383){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //2
    TIM_start();
    while(remote->time_count < 3593 && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3593){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 14){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < 3481){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 491){
            Motor4_control(2);
        }
        else if(remote->time_count >= 1796 && remote->time_count <= 2288){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3593){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //6
        if(remote->time_count < 3481){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //3
    TIM_start();
    while(remote->time_count < 3655 && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3655){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 21){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < 3563){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 357){
            Motor4_control(2);
        }
        else if(remote->time_count >= 1827 && remote->time_count <= 2184){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3655){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //6
        if(remote->time_count < 3562){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //4
    TIM_start();
    while(remote->time_count < 3687 && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3687){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 29){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < 3626){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 434){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3687){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //6
        if(remote->time_count < 3626){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //5
    TIM_start();
    while(remote->time_count < 3691 && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3691){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 36){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < 3670){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 145){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3690){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //6
        if(remote->time_count < 3670){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }
    }
    Motor1_control(0);
    Motor2_control(0);
    Motor3_control(0);
    Motor4_control(0);
    Motor5_control(0);
    Motor6_control(0);
    TIM_stop(&remote->time_count);
    remote->Statu = Initial_bend_statu_2;
}


/**
 * @brief  第一版向左侧屈
 * @param  void
 * @retval none
 * @note   侧屈-25
 */
void LeftBend_1(Remote_t *remote){
    // 1
    TIM_start();
    while(remote->time_count < 3807 + 800 && remote->MODE_flag != STOP_MODE){
        //3
        if(remote->time_count < (3828 + 460)){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }

        // 2
        // if(remote->time_count < 4){
        //     Motor2_control(1);
        // }
        // else{
        //     Motor2_control(0);
        // }

        //1
        if(remote->time_count < 3807 + 800){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }


        //4
        if(remote->time_count < 158){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }


        //6
        if(remote->time_count < (3828 + 700)){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }


        //5
        if(remote->time_count < (3807 + 400)){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }

    }
    TIM_stop(&remote->time_count);

    // HAL_Delay(1000);

    //2
    TIM_start();
    while(remote->time_count < (3760 + 800) && remote->MODE_flag != STOP_MODE){        
        //3
        if(remote->time_count < 3822 + 460){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }

        // //2
        // if(remote->time_count < 13){
        //     Motor2_control(1);
        // }
        // else{
        //     Motor2_control(0);
        // }

        //1
        if(remote->time_count < (3760 + 800)){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }


        //4
        if(remote->time_count < 369){
            Motor4_control(1);
        }
        else if(remote->time_count >= 3000 && remote->time_count < 3034){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }


        //6
        if(remote->time_count < 3822 + 700){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }


        //5
        if(remote->time_count < (3760 + 400)){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }

    }
    TIM_stop(&remote->time_count);

    //3
    TIM_start();
    while(remote->time_count < (3691 + 800) && remote->MODE_flag != STOP_MODE){   
        //3
        if(remote->time_count < 3783 + 460){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }

        // //2
        // if(remote->time_count < 21){
        //     Motor2_control(1);
        // }
        // else{
        //     Motor2_control(0);
        // }

        //1
        if(remote->time_count < (3691 + 800)){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }


        //4
        if(remote->time_count < 613){
            Motor4_control(1);
        }
        else if(remote->time_count >= 3000 && remote->time_count < 3160){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }


        //6
        if(remote->time_count < 3783 + 700){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }


        //5
        if(remote->time_count < (3690 + 400)){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //4
    TIM_start();
    while(remote->time_count < (3710 + 700) && remote->MODE_flag != STOP_MODE){
        //3
        if(remote->time_count < 3709 + 460){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }

        // //2
        // if(remote->time_count < 30){
        //     Motor2_control(1);
        // }
        // else{
        //     Motor2_control(0);
        // }

        //1
        if(remote->time_count < (3601 + 800)){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }


        //4
        if(remote->time_count < 858){
            Motor4_control(1);
        }
        else if(remote->time_count >= 3000 && remote->time_count < 3203){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }


        //6
        if(remote->time_count < 3710 + 700){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }


        //5
        if(remote->time_count < (3600 + 400)){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //5
    TIM_start();
    while(remote->time_count < (3596 + 700) && remote->MODE_flag != STOP_MODE){
        //3
        if(remote->time_count < 3595 + 460){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }

        // //2
        // if(remote->time_count < 38){
        //     Motor2_control(1);
        // }
        // else{
        //     Motor2_control(0);
        // }

        //1
        if(remote->time_count < (3493 + 800)){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }


        //4
        if(remote->time_count < 1109){
            Motor4_control(1);
        }
        else if(remote->time_count >= 3000 && remote->time_count < 3220){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }


        //6
        if(remote->time_count < 3596 + 700){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }


        //5
        if(remote->time_count < (3493 + 400)){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
    }
    Motor1_control(0);
    Motor2_control(0);
    Motor3_control(0);  
    Motor4_control(0);
    Motor5_control(0);
    Motor6_control(0);
    TIM_stop(&remote->time_count);
    remote->Statu = Left_statu_1;
}

/**
 * @brief  第二版向左侧屈
 * @param  void
 * @retval none
 * @note   侧屈-25
 */
void RightBend_2(Remote_t *remote){
    // 1
    TIM_start();
    while(remote->time_count < 3691 && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3669){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 44){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < 3691){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 145){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3669){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //6
        if(remote->time_count < 3691){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //2
    TIM_start();
    while(remote->time_count < 3687 && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3626){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 51){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < 3687){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 216){
            Motor4_control(1);
        }
        else if (remote->time_count >= 1843 && remote->time_count <= 2060)
        {
            Motor4_control(1);
        }
        
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3626){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //6
        if(remote->time_count < 3687){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //3
    TIM_start();
    while(remote->time_count < 3656 && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3563){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 57){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < 3655){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 357){
            Motor4_control(1);
        }
        else if (remote->time_count >= 1828 && remote->time_count <= 2185)
        {
            Motor4_control(1);
        }
        
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3563){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //6
        if(remote->time_count < 3656){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //4
    TIM_start();
    while(remote->time_count < 3593 && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3481){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 63){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < 3592){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 491){
            Motor4_control(1);
        }
        else if(remote->time_count >= 1796 && remote->time_count <= 2288){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3481){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //6
        if(remote->time_count < 3592){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //5
    TIM_start();
    while(remote->time_count < 3495 && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3384){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 69){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < 3495){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 616){
            Motor4_control(1);
        }
        else if(remote->time_count >= 1747 && remote->time_count <= 2364){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3383){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //6
        if(remote->time_count < 3495){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }
    }
    Motor1_control(0);
    Motor2_control(0);
    Motor3_control(0);  
    Motor4_control(0);
    Motor5_control(0);
    Motor6_control(0);
    TIM_stop(&remote->time_count);
    remote->Statu = Left_statu_2;
}


/**
 * @brief  第一版向左侧屈回
 * @param  void
 * @retval none
 * @note   侧屈-25
 */
void LeftBend_back_1(Remote_t *remote){
    // 1    
    TIM_start();
    while(remote->time_count < (3596 + 700) && remote->MODE_flag != STOP_MODE){
        //3
        if(remote->time_count < 3595 + 460){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }

        //2
        // if(remote->time_count < 38){
        //     Motor2_control(2);
        // }
        // else{
        //     Motor2_control(0);
        // }

        //1
        if(remote->time_count < (3493)){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }


        //4
        if(remote->time_count < 1109){
            Motor4_control(2);
        }
        else if(remote->time_count >= 3000 && remote->time_count < 3220){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }


        //6
        if(remote->time_count < 3596 + 700){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }


        //5
        if(remote->time_count < (3493 + 400)){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    // HAL_Delay(1000);

    //2
    TIM_start();
    while(remote->time_count < (3710 + 700) && remote->MODE_flag != STOP_MODE){
        //3
        if(remote->time_count < 3709 + 460){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }

        // //2
        // if(remote->time_count < 30){
        //     Motor2_control(2);
        // }
        // else{
        //     Motor2_control(0);
        // }

        //1
        if(remote->time_count < (3601)){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }


        //4
        if(remote->time_count < 858){
            Motor4_control(2);
        }
        else if(remote->time_count >= 3000 && remote->time_count < 3203){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }


        //6
        if(remote->time_count < 3710 + 700){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }


        //5
        if(remote->time_count < (3600 + 400)){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
    }
    TIM_stop(&remote->time_count);


    //3
    TIM_start();
    while(remote->time_count < (3691 + 800) && remote->MODE_flag != STOP_MODE){   
        //3
        if(remote->time_count < 3783 + 460){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }

        // //2
        // if(remote->time_count < 21){
        //     Motor2_control(2);
        // }
        // else{
        //     Motor2_control(0);
        // }

        //1
        if(remote->time_count < (3691 )){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }


        //4
        if(remote->time_count < 613){
            Motor4_control(2);
        }
        else if(remote->time_count >= 3000 && remote->time_count < 3160){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }


        //6
        if(remote->time_count < 3783 + 700){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }


        //5
        if(remote->time_count < (3690 + 400)){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //4
    TIM_start();
    while(remote->time_count < (3760 + 800) && remote->MODE_flag != STOP_MODE){        
        //3
        if(remote->time_count < 3822 + 460){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }

        // //2
        // if(remote->time_count < 13){
        //     Motor2_control(2);
        // }
        // else{
        //     Motor2_control(0);
        // }

        //1
        if(remote->time_count < (3760 )){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }


        //4
        if(remote->time_count < 369){
            Motor4_control(2);
        }
        else if(remote->time_count >= 3000 && remote->time_count < 3034){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }


        //6
        if(remote->time_count < 3822 + 700){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }


        //5
        if(remote->time_count < (3760 + 400)){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }

    }
    TIM_stop(&remote->time_count);
    //5
    TIM_start();
    while(remote->time_count < 3807 + 800 && remote->MODE_flag != STOP_MODE){
        //3
        if(remote->time_count < (3828 + 460)){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }

        // //2
        // if(remote->time_count < 4){
        //     Motor2_control(2);
        // }
        // else{
        //     Motor2_control(0);
        // }

        //1
        if(remote->time_count < 3807 ){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }


        //4
        if(remote->time_count < 158){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }


        //6
        if(remote->time_count < (3828 + 700)){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }


        //5
        if(remote->time_count < (3807 + 400)){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }

    }
    TIM_stop(&remote->time_count);
    Motor1_control(0);
    Motor2_control(0);
    Motor3_control(0);  
    Motor4_control(0);
    Motor5_control(0);
    Motor6_control(0);
    TIM_stop(&remote->time_count);
    remote->Statu = Initial_bend_statu_1;
}

/**
 * @brief  第二版向左侧屈回
 * @param  void
 * @retval none
 * @note   侧屈-25
 */
void RightBend_back_2(Remote_t *remote){
    // 1
    TIM_start();
    while(remote->time_count < 3495 && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3384){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 69){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < 3495){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 616){
            Motor4_control(2);
        }
        else if(remote->time_count >= 1747 && remote->time_count <= 2364){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3383){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
        //6
        if(remote->time_count < 3495){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //2
    TIM_start();
    while(remote->time_count < 3593 && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3481){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 63){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < 3592){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 491){
            Motor4_control(2);
        }
        else if(remote->time_count >= 1796 && remote->time_count <= 2288){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3481){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
        //6
        if(remote->time_count < 3592){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //3
    TIM_start();
    while(remote->time_count < 3656 && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3563){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 57){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < 3655){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 357){
            Motor4_control(2);
        }
        else if (remote->time_count >= 1828 && remote->time_count <= 2185)
        {
            Motor4_control(2);
        }
        
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3563){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
        //6
        if(remote->time_count < 3656){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //4
    TIM_start();
    while(remote->time_count < 3687 && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3626){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 51){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < 3687){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 216){
            Motor4_control(2);
        }
        else if (remote->time_count >= 1843 && remote->time_count <= 2060)
        {
            Motor4_control(2);
        }
        
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3626){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
        //6
        if(remote->time_count < 3687){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    //5
    TIM_start();
    while(remote->time_count < 3691 && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 3669){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 44){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < 3691){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 145){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 3669){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
        //6
        if(remote->time_count < 3691){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }
    }
    Motor1_control(0);
    Motor2_control(0);
    Motor3_control(0);  
    Motor4_control(0);
    Motor5_control(0);
    Motor6_control(0);
    TIM_stop(&remote->time_count);
    remote->Statu = Initial_bend_statu_2;
}


/**
 * @brief  向上30mm
 * @param  void
 * @retval none
 */
void UP30_1(Remote_t *remote){
    // 1
    TIM_start();
    while(remote->time_count < (1498) && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 1417){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 1498){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < (1417)){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 1497){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 1417){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }


        //6
        if(remote->time_count < 1417){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }

    }
    TIM_stop(&remote->time_count);

    // HAL_Delay(1000);

    //2
    TIM_start();
    while(remote->time_count < (1498) && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 1420){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 1498){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < (1420)){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 1497){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 1420){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }


        //6
        if(remote->time_count < 1420){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }

    }
    TIM_stop(&remote->time_count);

    //3
    TIM_start();
    while(remote->time_count < (1498) && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 1422){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 1498){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < (1422)){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 1497){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 1422){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }


        //6
        if(remote->time_count < 1422){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }

    }
    TIM_stop(&remote->time_count);

    //4
    TIM_start();
    while(remote->time_count < (1498) && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 1424){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 1498){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < (1424)){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 1497){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 1424){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }


        //6
        if(remote->time_count < 1424){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }

    }
    TIM_stop(&remote->time_count);

    //5
    TIM_start();
    while(remote->time_count < (1499) && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 1427){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 1499){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < (1427)){
            Motor3_control(1);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 1497){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 1427){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }


        //6
        if(remote->time_count < 1427){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }

    }
    Motor1_control(0);
    Motor2_control(0);
    Motor3_control(0);  
    Motor4_control(0);
    Motor5_control(0);
    Motor6_control(0);
    TIM_stop(&remote->time_count);
    remote->Statu = Up_statu;

}



/**
 * @brief  向下30mm
 * @param  void
 * @retval none
 */
void DOWN30_1(Remote_t *remote){
    // 1
    TIM_start();
    while(remote->time_count < (1499) && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 1427){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 1499){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < (1427)){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 1497){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 1427){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }


        //6
        if(remote->time_count < 1427){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }

    }
    TIM_stop(&remote->time_count);

    // HAL_Delay(1000);

    //2
    TIM_start();
    while(remote->time_count < (1498) && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 1424){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 1498){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < (1424)){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 1497){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 1424){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }


        //6
        if(remote->time_count < 1424){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }

    }
    TIM_stop(&remote->time_count);

    //3
    TIM_start();
    while(remote->time_count < (1498) && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 1422){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 1498){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < (1422)){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 1497){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 1422){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }


        //6
        if(remote->time_count < 1422){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }

    }
    TIM_stop(&remote->time_count);

    //4
    TIM_start();
    while(remote->time_count < (1498) && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 1420){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 1498){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < (1420)){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 1497){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 1420){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }


        //6
        if(remote->time_count < 1420){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }

    }
    TIM_stop(&remote->time_count);

    //5
    TIM_start();
    while(remote->time_count < (1498) && remote->MODE_flag != STOP_MODE){
        //1
        if(remote->time_count < 1417){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }

        //2
        if(remote->time_count < 1498){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }

        //3
        if(remote->time_count < (1417)){
            Motor3_control(2);
        }
        else{
            Motor3_control(0);
        }


        //4
        if(remote->time_count < 1497){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }


        //5
        if(remote->time_count < 1417){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }


        //6
        if(remote->time_count < 1417){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }

    }
    Motor1_control(0);
    Motor2_control(0);
    Motor3_control(0);  
    Motor4_control(0);
    Motor5_control(0);
    Motor6_control(0);
    TIM_stop(&remote->time_count);
    remote->Statu = Initial_lift_statu_1;
}



/**
 * @brief  复合运动
 * @param  void
 * @retval none
 */
void complex_move_1(Remote_t *remote){
    // 1
    TIM_start();
    while(remote->time_count < 6357 && remote->MODE_flag != STOP_MODE){
        //杆1
        if(remote->time_count < 125 || (remote->time_count >= 3000 && remote->time_count < 3000+125)){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }
        //杆2
        if(remote->time_count < 1172 || (remote->time_count >= 2000 && remote->time_count < 2000+1172) || (remote->time_count >= 4000 && remote->time_count < 4000+1172)){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }
        //杆3
        if(remote->time_count < 6357)
            Motor3_control(2);
        else{
            Motor3_control(0);
        }

        //杆4
        if(remote->time_count < 1213 || (remote->time_count >= 2000 && remote->time_count < 2000+1213) || (remote->time_count >= 4000 && remote->time_count < 4000+1213)){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }
        //杆5
        if(remote->time_count < 6350){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 117 || (remote->time_count >= 3000 && remote->time_count < 3000+117)){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    // HAL_Delay(1000);

    //2
    TIM_start();
    while(remote->time_count < 6342 && remote->MODE_flag != STOP_MODE){
        //杆1
        if(remote->time_count < 133 || (remote->time_count >= 3000 && remote->time_count < 3000+133)){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }
        //杆2
        if(remote->time_count < 1157 || (remote->time_count >= 2000 && remote->time_count < 2000+1157) || (remote->time_count >= 4000 && remote->time_count < 4000+1157)){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }
        //杆3
        if(remote->time_count < 6342)
            Motor3_control(2);
        else{
            Motor3_control(0);
        }

        //杆4
        if(remote->time_count < 1277 || (remote->time_count >= 2000 && remote->time_count < 2000+1277) || (remote->time_count >= 4000 && remote->time_count < 4000+1277)){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }
        //杆5
        if(remote->time_count < 6320){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 109 || (remote->time_count >= 3000 && remote->time_count < 3000+109)){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    // HAL_Delay(1000);

    //3
    TIM_start();
    while(remote->time_count < 6301 && remote->MODE_flag != STOP_MODE){
        //杆1
        if(remote->time_count < 139 || (remote->time_count >= 3000 && remote->time_count < 3000+139)){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }
        //杆2
        if(remote->time_count < 1157 || (remote->time_count >= 2000 && remote->time_count < 2000+1157) || (remote->time_count >= 4000 && remote->time_count < 4000+1157)){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }
        //杆3
        if(remote->time_count < 6301)
            Motor3_control(2);
        else{
            Motor3_control(0);
        }

        //杆4
        if(remote->time_count < 1332 || (remote->time_count >= 2000 && remote->time_count < 2000+1332) || (remote->time_count >= 4000 && remote->time_count < 4000+1332)){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }
        //杆5
        if(remote->time_count < 6268){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 104 || (remote->time_count >= 3000 && remote->time_count < 3000+104)){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    // HAL_Delay(1000);

    //4
    TIM_start();
    while(remote->time_count < 6235 && remote->MODE_flag != STOP_MODE){
        //杆1
        if(remote->time_count < 142 || (remote->time_count >= 3000 && remote->time_count < 3000+142)){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }
        //杆2
        if(remote->time_count < 1104 || (remote->time_count >= 2000 && remote->time_count < 2000+1104) || (remote->time_count >= 4000 && remote->time_count < 4000+1104)){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }
        //杆3
        if(remote->time_count < 6235)
            Motor3_control(2);
        else{
            Motor3_control(0);
        }

        //杆4
        if(remote->time_count < 1380 || (remote->time_count >= 2000 && remote->time_count < 2000+1380) || (remote->time_count >= 4000 && remote->time_count < 4000+1380)){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }
        //杆5
        if(remote->time_count < 6196){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 103 || (remote->time_count >= 3000 && remote->time_count < 3000+103)){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    // HAL_Delay(1000);

    //5
    TIM_start();
    while(remote->time_count < 6139 && remote->MODE_flag != STOP_MODE){
        //杆1
        if(remote->time_count < 139 || (remote->time_count >= 3000 && remote->time_count < 3000+139)){
            Motor1_control(2);
        }
        else{
            Motor1_control(0);
        }
        //杆2
        if(remote->time_count < 1065 || (remote->time_count >= 2000 && remote->time_count < 2000+1065) || (remote->time_count >= 4000 && remote->time_count < 4000+1065)){
            Motor2_control(2);
        }
        else{
            Motor2_control(0);
        }
        //杆3
        if(remote->time_count < 6139)
            Motor3_control(2);
        else{
            Motor3_control(0);
        }

        //杆4
        if(remote->time_count < 1420 || (remote->time_count >= 2000 && remote->time_count < 2000+1420) || (remote->time_count >= 4000 && remote->time_count < 4000+1420)){
            Motor4_control(1);
        }
        else{
            Motor4_control(0);
        }
        //杆5
        if(remote->time_count < 6102){
            Motor5_control(1);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 107 || (remote->time_count >= 3000 && remote->time_count < 3000+107)){
            Motor6_control(1);
        }
        else{
            Motor6_control(0);
        }
    }
    Motor1_control(0);
    Motor2_control(0);
    Motor3_control(0);  
    Motor4_control(0);
    Motor5_control(0);
    Motor6_control(0);
    TIM_stop(&remote->time_count);
    remote->Statu = Complex_statu;
}


/**
 * @brief  复合运动回归
 * @param  void
 * @retval none
 */
void complex_back_1(Remote_t *remote){
    // 1
    TIM_start();
    while(remote->time_count < 6139 && remote->MODE_flag != STOP_MODE){
        //杆1
        if(remote->time_count < 139 || (remote->time_count >= 3000 && remote->time_count < 3000+139)){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }
        //杆2
        if(remote->time_count < 1065 || (remote->time_count >= 2000 && remote->time_count < 2000+1065) || (remote->time_count >= 4000 && remote->time_count < 4000+1065)){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }
        //杆3
        if(remote->time_count < 6139)
            Motor3_control(1);
        else{
            Motor3_control(0);
        }

        //杆4
        if(remote->time_count < 1420 || (remote->time_count >= 2000 && remote->time_count < 2000+1420) || (remote->time_count >= 4000 && remote->time_count < 4000+1420)){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }
        //杆5
        if(remote->time_count < 6102){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 107 || (remote->time_count >= 3000 && remote->time_count < 3000+107)){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    // HAL_Delay(1000);

    //2
    TIM_start();
    while(remote->time_count < 6235 && remote->MODE_flag != STOP_MODE){
        //杆1
        if(remote->time_count < 142 || (remote->time_count >= 3000 && remote->time_count < 3000+142)){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }
        //杆2
        if(remote->time_count < 1104 || (remote->time_count >= 2000 && remote->time_count < 2000+1104) || (remote->time_count >= 4000 && remote->time_count < 4000+1104)){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }
        //杆3
        if(remote->time_count < 6235)
            Motor3_control(1);
        else{
            Motor3_control(0);
        }

        //杆4
        if(remote->time_count < 1380 || (remote->time_count >= 2000 && remote->time_count < 2000+1380) || (remote->time_count >= 4000 && remote->time_count < 4000+1380)){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }
        //杆5
        if(remote->time_count < 6196){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 103 || (remote->time_count >= 3000 && remote->time_count < 3000+103)){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    // HAL_Delay(1000);

    //3
    TIM_start();
    while(remote->time_count < 6301 && remote->MODE_flag != STOP_MODE){
        //杆1
        if(remote->time_count < 139 || (remote->time_count >= 3000 && remote->time_count < 3000+139)){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }
        //杆2
        if(remote->time_count < 1157 || (remote->time_count >= 2000 && remote->time_count < 2000+1157) || (remote->time_count >= 4000 && remote->time_count < 4000+1157)){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }
        //杆3
        if(remote->time_count < 6301)
            Motor3_control(1);
        else{
            Motor3_control(0);
        }

        //杆4
        if(remote->time_count < 1332 || (remote->time_count >= 2000 && remote->time_count < 2000+1332) || (remote->time_count >= 4000 && remote->time_count < 4000+1332)){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }
        //杆5
        if(remote->time_count < 6268){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 104 || (remote->time_count >= 3000 && remote->time_count < 3000+104)){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    // HAL_Delay(1000);

    //4
    TIM_start();
    while(remote->time_count < 6342 && remote->MODE_flag != STOP_MODE){
        //杆1
        if(remote->time_count < 133 || (remote->time_count >= 3000 && remote->time_count < 3000+133)){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }
        //杆2
        if(remote->time_count < 1157 || (remote->time_count >= 2000 && remote->time_count < 2000+1157) || (remote->time_count >= 4000 && remote->time_count < 4000+1157)){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }
        //杆3
        if(remote->time_count < 6342)
            Motor3_control(1);
        else{
            Motor3_control(0);
        }

        //杆4
        if(remote->time_count < 1277 || (remote->time_count >= 2000 && remote->time_count < 2000+1277) || (remote->time_count >= 4000 && remote->time_count < 4000+1277)){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }
        //杆5
        if(remote->time_count < 6320){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 109 || (remote->time_count >= 3000 && remote->time_count < 3000+109)){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }
    }
    TIM_stop(&remote->time_count);

    // HAL_Delay(1000);

    //5
    TIM_start();
    while(remote->time_count < 6357 && remote->MODE_flag != STOP_MODE){
        //杆1
        if(remote->time_count < 125 || (remote->time_count >= 3000 && remote->time_count < 3000+125)){
            Motor1_control(1);
        }
        else{
            Motor1_control(0);
        }
        //杆2
        if(remote->time_count < 1172 || (remote->time_count >= 2000 && remote->time_count < 2000+1172) || (remote->time_count >= 4000 && remote->time_count < 4000+1172)){
            Motor2_control(1);
        }
        else{
            Motor2_control(0);
        }
        //杆3
        if(remote->time_count < 6357)
            Motor3_control(1);
        else{
            Motor3_control(0);
        }

        //杆4
        if(remote->time_count < 1213 || (remote->time_count >= 2000 && remote->time_count < 2000+1213) || (remote->time_count >= 4000 && remote->time_count < 4000+1213)){
            Motor4_control(2);
        }
        else{
            Motor4_control(0);
        }
        //杆5
        if(remote->time_count < 6350){
            Motor5_control(2);
        }
        else{
            Motor5_control(0);
        }
        //杆6
        if(remote->time_count < 117 || (remote->time_count >= 3000 && remote->time_count < 3000+117)){
            Motor6_control(2);
        }
        else{
            Motor6_control(0);
        }
    }
    Motor1_control(0);
    Motor2_control(0);
    Motor3_control(0);  
    Motor4_control(0);
    Motor5_control(0);
    Motor6_control(0);
    TIM_stop(&remote->time_count);;
    remote->Statu = Initial_bend_statu_1;
}

/**
 * @brief  开始计时
 * @param  void
 * @retval none
 */
void TIM_start(void){
    HAL_TIM_Base_Start_IT(&htim2);
    return;
}

/**
 * @brief  停止计时
 * @param  void
 * @retval none
 */
void TIM_stop(uint32_t *time){
    __HAL_TIM_CLEAR_FLAG(&htim2, TIM_FLAG_UPDATE);
    HAL_TIM_Base_Stop_IT(&htim2);
    *time = 0;
    return;
}


/**
 * @brief  统一设置
 * @param  state 设置电机状态
 * @retval none
 * @note   0关闭，1正转，2反转
 */
void Motor_ALL_set(uint8_t state){
    Motor1_control(state);
    Motor2_control(state);
    Motor3_control(state);  
    Motor4_control(state);
    Motor5_control(state);
    Motor6_control(state);
}


/**
 * @brief  电机1控制
 * @param  state 设置电机状态
 * @retval none
 * @note   0关闭，1正转，2反转
 */
void Motor6_control(uint8_t state){
    switch(state){
        case 0:
            HAL_GPIO_WritePin(portA_GPIO_Port, portA_Pin, GPIO_PIN_RESET);
            HAL_GPIO_WritePin(portB_GPIO_Port, portB_Pin, GPIO_PIN_RESET);
            break;
        case 1:
            HAL_GPIO_WritePin(portA_GPIO_Port, portA_Pin, GPIO_PIN_SET);
            HAL_GPIO_WritePin(portB_GPIO_Port, portB_Pin, GPIO_PIN_RESET);
            break;
        case 2:
            HAL_GPIO_WritePin(portA_GPIO_Port, portA_Pin, GPIO_PIN_RESET);
            HAL_GPIO_WritePin(portB_GPIO_Port, portB_Pin, GPIO_PIN_SET);
            break;
        default:
            break;
    }
}

/**
 * @brief  电机2控制
 * @param  state 设置电机状态
 * @retval none
 * @note   0关闭，1正转，2反转
 */
void Motor4_control(uint8_t state){
    switch(state){
        case 0:
            HAL_GPIO_WritePin(portC_GPIO_Port, portC_Pin, GPIO_PIN_RESET);
            HAL_GPIO_WritePin(portD_GPIO_Port, portD_Pin, GPIO_PIN_RESET);
            break;
        case 1:
            HAL_GPIO_WritePin(portC_GPIO_Port, portC_Pin, GPIO_PIN_SET);
            HAL_GPIO_WritePin(portD_GPIO_Port, portD_Pin, GPIO_PIN_RESET);
            break;
        case 2:
            HAL_GPIO_WritePin(portC_GPIO_Port, portC_Pin, GPIO_PIN_RESET);
            HAL_GPIO_WritePin(portD_GPIO_Port, portD_Pin, GPIO_PIN_SET);
            break;
        default:
            break;
    }    
}

/**
 * @brief  电机3控制
 * @param  state 设置电机状态
 * @retval none
 * @note   0关闭，1正转，2反转
 */
void Motor5_control(uint8_t state){
    switch(state){
        case 0:
            HAL_GPIO_WritePin(portE_GPIO_Port, portE_Pin, GPIO_PIN_RESET);
            HAL_GPIO_WritePin(portF_GPIO_Port, portF_Pin, GPIO_PIN_RESET);
            break;
        case 1:
            HAL_GPIO_WritePin(portE_GPIO_Port, portE_Pin, GPIO_PIN_SET);
            HAL_GPIO_WritePin(portF_GPIO_Port, portF_Pin, GPIO_PIN_RESET);
            break;
        case 2:
            HAL_GPIO_WritePin(portE_GPIO_Port, portE_Pin, GPIO_PIN_RESET);
            HAL_GPIO_WritePin(portF_GPIO_Port, portF_Pin, GPIO_PIN_SET);
            break;
        default:
            break;
    }    
}

/**
 * @brief  电机4控制
 * @param  state 设置电机状态
 * @retval none
 * @note   0关闭，1正转，2反转
 */
void Motor1_control(uint8_t state){
    switch(state){
        case 0:
            HAL_GPIO_WritePin(portG_GPIO_Port, portG_Pin, GPIO_PIN_RESET);
            HAL_GPIO_WritePin(portH_GPIO_Port, portH_Pin, GPIO_PIN_RESET);
            break;
        case 1: 
            HAL_GPIO_WritePin(portG_GPIO_Port, portG_Pin, GPIO_PIN_SET);
            HAL_GPIO_WritePin(portH_GPIO_Port, portH_Pin, GPIO_PIN_RESET);
            break;
        case 2:
            HAL_GPIO_WritePin(portG_GPIO_Port, portG_Pin, GPIO_PIN_RESET);
            HAL_GPIO_WritePin(portH_GPIO_Port, portH_Pin, GPIO_PIN_SET);
            break;
        default:
            break;
    }    
}       

/**
 * @brief  电机5控制
 * @param  state 设置电机状态
 * @retval none
 * @note   0关闭，1正转，2反转
 */
void Motor2_control(uint8_t state){
    switch(state){
        case 0:
            HAL_GPIO_WritePin(portS_GPIO_Port, portS_Pin, GPIO_PIN_RESET);
            HAL_GPIO_WritePin(portT_GPIO_Port, portT_Pin, GPIO_PIN_RESET);
            break;
        case 1: 
            HAL_GPIO_WritePin(portS_GPIO_Port, portS_Pin, GPIO_PIN_SET);
            HAL_GPIO_WritePin(portT_GPIO_Port, portT_Pin, GPIO_PIN_RESET);
            break;
        case 2:
            HAL_GPIO_WritePin(portS_GPIO_Port, portS_Pin, GPIO_PIN_RESET);
            HAL_GPIO_WritePin(portT_GPIO_Port, portT_Pin, GPIO_PIN_SET);
            break;
        default:
            break;
    }    
}       

/**
 * @brief  电机6控制
 * @param  state 设置电机状态
 * @retval none
 */
void Motor3_control(uint8_t state){
    switch(state){
        case 0:
            HAL_GPIO_WritePin(portU_GPIO_Port, portU_Pin, GPIO_PIN_RESET);
            HAL_GPIO_WritePin(portV_GPIO_Port, portV_Pin, GPIO_PIN_RESET);
            break;
        case 1: 
            HAL_GPIO_WritePin(portU_GPIO_Port, portU_Pin, GPIO_PIN_SET);
            HAL_GPIO_WritePin(portV_GPIO_Port, portV_Pin, GPIO_PIN_RESET);
            break;
        case 2:
            HAL_GPIO_WritePin(portU_GPIO_Port, portU_Pin, GPIO_PIN_RESET);
            HAL_GPIO_WritePin(portV_GPIO_Port, portV_Pin, GPIO_PIN_SET);
            break;
        default:
            break;
    }    
}     




